.\" Copyright (c) 2005 SPARTA, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.\" Note: The date here should be updated whenever a non-trivial
.\" change is made to the manual page.
.Dd May 5, 2005
.Dt SETLCID 3
.Os
.Sh NAME
.Nm setlcid
.Nd "set login context"
.Sh SYNOPSIS
.In sys/lctx.h 
.Ft int
.Fn setlcid "pid_t pid" "pid_t lcid"
.Sh DESCRIPTION
The
.Fn setlcid
system call sets the login context of the specified process
.Fa pid
to the specified
.Fa lcid .
If the
.Fa pid
is zero, then the call applies to the current process.
If the
.Fa lcid
is zero a new login context will be created.
If the
.Fa lcid
is \-1 the process will be removed from the login context
it is currently a member of, if any.
.Pp
Creation of a new login context is only valid for the current process.
A process may not create a new login context if it is currently a member
of one.
.Pp
Superuser privilege is required to add or remove a process from
a login context.
.Sh RETURN VALUES
.Rv -std setlcid
.Sh ERRORS
The
.Fn setlcid
function will fail if:
.Bl -tag -width Er
.It Bq Er EPERM
Operation not permitted.
.It Bq Er ESRCH
No such process.
.It Bq Er ENOMEM
Cannot allocate memory.
.It Bq Er ENOATTR
Attribute not found.
.El
.Sh SEE ALSO
.Xr getlcid 2
.Sh HISTORY
The
.Nm
manual page
first appeared in
.Fx 6.0 .
.Sh AUTHORS
This
manual page was written by
.An Matthew N. Dodd Aq mdodd@FreeBSD.org .
